<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>uartlite: xuartlite_intr_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">uartlite
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xuartlite__intr__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xuartlite_intr_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the UartLite driver (<a class="el" href="struct_x_uart_lite.html" title="The XUartLite driver instance data. ">XUartLite</a>) and hardware device using the interrupt mode. </p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>The user must provide a physical loopback such that data which is transmitted will be received.</p>
<p>MODIFICATION HISTORY: </p><pre>
Ver   Who  Date     Changes
<hr/>

1.00a jhl  02/13/02 First release
1.00b rpm  10/01/03 Made XIntc declaration global
1.00b sv   06/09/05 Minor changes to comply to Doxygen and coding guidelines
2.00a ktn  10/20/09 Updated to use HAL Processor APIs and minor changes
              for coding guidelnes.
3.2   ms   01/23/17 Added xil_printf statement in main function to
                    ensure that "Successfully ran" and "Failed" strings
                    are available in all examples. This is a fix for
                    CR-965028.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a189cb51308d09a387e9b48d5fee44136"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a189cb51308d09a387e9b48d5fee44136">UartLiteIntrExample</a> (u16 DeviceId)</td></tr>
<tr class="memdesc:a189cb51308d09a387e9b48d5fee44136"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does a minimal test on the UartLite device and driver as a design example.  <a href="#a189cb51308d09a387e9b48d5fee44136">More...</a><br /></td></tr>
<tr class="separator:a189cb51308d09a387e9b48d5fee44136"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9284857b8764a897d580555ca033813f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a9284857b8764a897d580555ca033813f">SetupInterruptSystem</a> (<a class="el" href="struct_x_uart_lite.html">XUartLite</a> *UartLitePtr)</td></tr>
<tr class="memdesc:a9284857b8764a897d580555ca033813f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function setups the interrupt system such that interrupts can occur for the UartLite device.  <a href="#a9284857b8764a897d580555ca033813f">More...</a><br /></td></tr>
<tr class="separator:a9284857b8764a897d580555ca033813f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60e3b0776621ce45f55d94b0fb959ff1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a60e3b0776621ce45f55d94b0fb959ff1">SendHandler</a> (void *CallBackRef, unsigned int EventData)</td></tr>
<tr class="memdesc:a60e3b0776621ce45f55d94b0fb959ff1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to send data to the UartLite.  <a href="#a60e3b0776621ce45f55d94b0fb959ff1">More...</a><br /></td></tr>
<tr class="separator:a60e3b0776621ce45f55d94b0fb959ff1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a964ea960d8251912f79e5a9fa9600f3e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a964ea960d8251912f79e5a9fa9600f3e">RecvHandler</a> (void *CallBackRef, unsigned int EventData)</td></tr>
<tr class="memdesc:a964ea960d8251912f79e5a9fa9600f3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to receive data from the UartLite.  <a href="#a964ea960d8251912f79e5a9fa9600f3e">More...</a><br /></td></tr>
<tr class="separator:a964ea960d8251912f79e5a9fa9600f3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to call the UartLite interrupt example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to call the UartLite interrupt example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p class="reference">References <a class="el" href="xuartlite__intr__example_8c.html#a189cb51308d09a387e9b48d5fee44136">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a id="a964ea960d8251912f79e5a9fa9600f3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a964ea960d8251912f79e5a9fa9600f3e">&#9670;&nbsp;</a></span>RecvHandler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RecvHandler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>EventData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to receive data from the UartLite. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized. It is called data is present in the receive FIFO of the UartLite such that the data can be retrieved from the UartLite. The size of the data present in the FIFO is not known when this function is called.</p>
<p>This handler provides an example of how to handle data for the UartLite, but is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver, in this case it is the instance pointer for the UartLite driver. </td></tr>
    <tr><td class="paramname">EventData</td><td>contains the number of bytes sent or received for sent and receive events.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a189cb51308d09a387e9b48d5fee44136">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a id="a60e3b0776621ce45f55d94b0fb959ff1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60e3b0776621ce45f55d94b0fb959ff1">&#9670;&nbsp;</a></span>SendHandler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SendHandler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>EventData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to send data to the UartLite. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the transmit FIFO of the UartLite is empty and more data can be sent through the UartLite.</p>
<p>This handler provides an example of how to handle data for the UartLite, but is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver. In this case it is the instance pointer for the UartLite driver. </td></tr>
    <tr><td class="paramname">EventData</td><td>contains the number of bytes sent or received for sent and receive events.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a189cb51308d09a387e9b48d5fee44136">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a id="a9284857b8764a897d580555ca033813f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9284857b8764a897d580555ca033813f">&#9670;&nbsp;</a></span>SetupInterruptSystem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SetupInterruptSystem </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_uart_lite.html">XUartLite</a> *&#160;</td>
          <td class="paramname"><em>UartLitePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function setups the interrupt system such that interrupts can occur for the UartLite device. </p>
<p>This function is application specific since the actual system may or may not have an interrupt controller. The UartLite could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">UartLitePtr</td><td>contains a pointer to the instance of the UartLite component which is going to be connected to the interrupt controller.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a189cb51308d09a387e9b48d5fee44136">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a id="a189cb51308d09a387e9b48d5fee44136"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a189cb51308d09a387e9b48d5fee44136">&#9670;&nbsp;</a></span>UartLiteIntrExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int UartLiteIntrExample </td>
          <td>(</td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>DeviceId</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does a minimal test on the UartLite device and driver as a design example. </p>
<p>The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_uart_lite.html" title="The XUartLite driver instance data. ">XUartLite</a> component.</p>
<p>This function sends data and expects to receive the same data through the UartLite. The user must provide a physical loopback such that data which is transmitted will be received.</p>
<p>This function uses interrupt driver mode of the UartLite device. The calls to the UartLite driver in the handlers should only use the non-blocking calls.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">DeviceId</td><td>is the Device ID of the UartLite Device and is the XPAR_&lt;uartlite_instance&gt;_DEVICE_ID value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This function contains an infinite loop such that if interrupts are not working it may never return. </p>

<p class="reference">References <a class="el" href="xuartlite__intr__example_8c.html#a964ea960d8251912f79e5a9fa9600f3e">RecvHandler()</a>, <a class="el" href="xuartlite__intr__example_8c.html#a60e3b0776621ce45f55d94b0fb959ff1">SendHandler()</a>, <a class="el" href="xuartlite__intr__example_8c.html#a9284857b8764a897d580555ca033813f">SetupInterruptSystem()</a>, <a class="el" href="group__uartlite__v3__1.html#gaca08a21fa15779ce8dedd2ac9f25971e">XUartLite_EnableInterrupt()</a>, <a class="el" href="group__uartlite__v3__1.html#gacf1026cbafbd78e1f3a7fd0ee433d001">XUartLite_Initialize()</a>, <a class="el" href="group__uartlite__v3__1.html#gabfbfaddf9ab531ff85a1c4f9036631aa">XUartLite_SelfTest()</a>, <a class="el" href="group__uartlite__v3__1.html#ga312d1ce48b9e29e08ebb25d942b2ff51">XUartLite_SetRecvHandler()</a>, and <a class="el" href="group__uartlite__v3__1.html#ga282cca48bbd4c1144c811681854fc780">XUartLite_SetSendHandler()</a>.</p>

<p class="reference">Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
